<template>
  <div>
    <ul>
      <li v-for="item in arr" :key="item">
        {{ item }} <button @click="del">删除</button>
      </li>
      <button @click="add">增加</button>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [1, 3, 5],
    };
  },

  created() {},

  methods: {
    del(index) {
      this.arr.splice(index, 1);
    },
    add() {
      this.arr.push(Math.floor(Math.random() * 100));
    },
  },
};
</script>

<style scoped></style>
